﻿using System;
using ImageConverter.Model.Enums;
using ImageConverter.Pooling;

namespace ImageConverter.Model
{
    public class ContainerItemEntry : ItemBase
    {
        public ItemStatusEnum Status
        {
            get
            {
                return status;
            }
            set
            {
                status = value;
                OnPropertyChanged("Status");
            }
        }

        public Dimensions Dimensions
        {
            get
            {
                return dimensions;
            }
            set
            {
                dimensions = value;
                OnPropertyChanged("Dimensions");
            }
        }

        public Dimensions InitialDimensions
        {
            get
            {
                return initialDimensions;
            }
            set
            {
                initialDimensions = value;
                OnPropertyChanged("InitialDimensions");
            }
        }

        public long InitialSize
        {
            get
            {
                return initialSize;
            }
            set
            {
                initialSize = value;
                OnPropertyChanged("InitialSize");
            }
        }

        public long Size
        {
            get
            {
                return size;
            }
            set
            {
                size = value;
                OnPropertyChanged("Size");
                OnPropertyChanged("DisplaySize");
            }
        }

        public string DisplaySize
        {
            get
            {
                if (size == 0)
                    return String.Empty;

                return (size / 1024).ToString() + 'k';
            }
        }

        #region Private fields

        private ItemStatusEnum status;
        private Dimensions dimensions;
        private Dimensions initialDimensions;
        private long initialSize;
        private long size;

        #endregion
    }
}
